import DS from 'ember-data';
import Ember from 'ember';
import BaseModel from './base-model';

//预警
var hbeaconWarning = BaseModel.extend({
    dateService: Ember.inject.service("date-service"),
    deviceId: DS.attr("string"), //按键id，与老人绑定
    callTime: DS.attr("number"), //呼叫时间
    reason: DS.attr("string"), //预警说明
    operater: DS.belongsTo('user'), //处理人
    flag: DS.belongsTo('dicttype'), //处理标识
    operateNote: DS.attr("string"), //处理说明
    caller: DS.belongsTo('Customer'), //呼叫老人



    status: Ember.computed("flag", function() {
        var flag = this.get("flag");
        if (flag == "hbeaconWarningCalling") {
            return "未处理";
        } else {
            return "已处理";
        }
    }),
    callTimeDate:Ember.computed("callTime",function(){
      var callTime=this.get("callTime");
      return this.get("dateService").timestampToTime(callTime);
    }),
    callTimeString:Ember.computed("callTime",function(){
      var callTime=this.get("callTime");
      return this.get("dateService").formatDate(callTime,"yyyy-MM-dd hh:mm:ss");

      }),
});
export default hbeaconWarning;
